<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>X^',
                    '<div>',
                        '<div>should not see this</div>',
                        '<div>A|B</div>',
                        '<div>CD</div>',
                    '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                'X|B',
                '<div>',
                    '<div>CD<br></div>',
                '</div>',
            '</div>',
        ].join('')),
        'Delete characters crossing DIV');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>^AB',
                    '<div>',
                        'should not see this',
                        '|<div>CD</div>',
                    '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '|<br>',
                '<div>',
                    '<div>CD</div>',
                '</div>',
            '</div>',
        ].join('')),
        'Delete characters before DIV');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>^AB',
                    '<div>',
                        'should not see this',
                        '<div>C|D</div>',
                    '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<div>',
                    '<div>',
                        '<div>|D</div>',
                    '</div>',
                '</div>',
            '</div>',
        ].join('')),
        'Delete characters to middle of DIV');
</script>
